<?php

declare(strict_types=1);

namespace app\admin\model;

use think\Model;

/**
 * @mixin \think\Model
 */
class Invoice extends BaseModel
{
    //
    // 设置表名
    protected $name = 'invoice';

    // 自动写入时间戳字段
    protected $autoWriteTimestamp = false;

    // 定义时间戳字段名
    protected $createTime = 'create_time';
    protected $updateTime = 'update_time';

    // 是否开启软删除
    protected $deleteTime = 'is_del';

    // 数据表主键
    protected $pk = 'id';


    protected $attributes = [
        'order_type' => [
            'wholesal' => '经销商订单',
            'order' => '普通订单',
        ],
        'invoice_type' => [
            1 => '增值税普通发票',
            2 => '增值税专用发票',
        ],
        'status' => [
            1=> '待审核',
            10 => '待开票',
            // 20 => '开票中',
            30 => '已取消',
            40 => '已完成',
        ]
    ];

    /**
     * @describe
     * @author: Bobo
     * @date: 2025-02-11 17:05:24 
     * @param [type] @required
     * @return Renderable
     */
    public function getFieldEnum($field = 'all')
    {
        return $this->getEnum(strtoupper($field), [], 'label');
    }
}
